# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Spanner.V1.Model.CopyBackupRequest do
  @moduledoc """
  The request for CopyBackup.

  ## Attributes

  *   `backupId` (*type:* `String.t`, *default:* `nil`) - Required. The id of the backup copy. The `backup_id` appended to `parent` forms the full backup_uri of the form `projects//instances//backups/`.
  *   `encryptionConfig` (*type:* `GoogleApi.Spanner.V1.Model.CopyBackupEncryptionConfig.t`, *default:* `nil`) - Optional. The encryption configuration used to encrypt the backup. If this field is not specified, the backup will use the same encryption configuration as the source backup by default, namely encryption_type = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`.
  *   `expireTime` (*type:* `DateTime.t`, *default:* `nil`) - Required. The expiration time of the backup in microsecond granularity. The expiration time must be at least 6 hours and at most 366 days from the `create_time` of the source backup. Once the `expire_time` has passed, the backup is eligible to be automatically deleted by Cloud Spanner to free the resources used by the backup.
  *   `sourceBackup` (*type:* `String.t`, *default:* `nil`) - Required. The source backup to be copied. The source backup needs to be in READY state for it to be copied. Once CopyBackup is in progress, the source backup cannot be deleted or cleaned up on expiration until CopyBackup is finished. Values are of the form: `projects//instances//backups/`.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :backupId => String.t() | nil,
          :encryptionConfig => GoogleApi.Spanner.V1.Model.CopyBackupEncryptionConfig.t() | nil,
          :expireTime => DateTime.t() | nil,
          :sourceBackup => String.t() | nil
        }

  field(:backupId)
  field(:encryptionConfig, as: GoogleApi.Spanner.V1.Model.CopyBackupEncryptionConfig)
  field(:expireTime, as: DateTime)
  field(:sourceBackup)
end

defimpl Poison.Decoder, for: GoogleApi.Spanner.V1.Model.CopyBackupRequest do
  def decode(value, options) do
    GoogleApi.Spanner.V1.Model.CopyBackupRequest.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Spanner.V1.Model.CopyBackupRequest do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
